cmake_minimum_required(VERSION 3.12.4)

# 检查CROSS_COMPILE_PATH是否已定义
if(NOT DEFINED CROSS_COMPILE_PATH)
    include(${CMAKE_SOURCE_DIR}/toolchain.cmake)
endif()

# 设置项目名称
project(am335x_drivers)

# 设置内核源码路径
set(KERNEL_SRC "${CMAKE_SOURCE_DIR}/../../../../kernel/kernel-3.2" CACHE STRING "Path to kernel source")

# 检查内核源码目录是否存在
if(NOT EXISTS ${KERNEL_SRC})
    message(FATAL_ERROR "内核源码目录 '${KERNEL_SRC}' 不存在，请检查KERNEL_SRC路径配置！")
endif()

add_subdirectory(rtl8188eu)